package com.example.pei.ithinklearnt.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.io.Serializable;

import cn.bmob.v3.BmobUser;
import cn.bmob.v3.datatype.BmobFile;
import cn.bmob.v3.datatype.BmobGeoPoint;

/**
 * 用户bean
 * Created by PEI on 2017/9/27.
 */

public class UserInfo extends BmobUser implements Parcelable,Serializable {

    private String nickName;        //昵称 可随意修改
    private String headFileUrl;    //头像文件在服务器中url
    private String birthDay;
    private String coverFileUrl;  //封面文件在服务器中url
    private Integer sex;  //0女 1男
    private Integer userType;  //用户类型 0代表管理员，1代表普通用户
    private BmobGeoPoint gpsLocate;  //用户最后一次更新的坐标

    public UserInfo(){
    }
    public UserInfo(Parcel in){
        //顺序要和writeToParcel写的顺序一样
        setNickName(in.readString());
        setUsername(in.readString());
        setMobilePhoneNumber(in.readString());
        setObjectId(in.readString());
        setSessionToken(in.readString());
        setCreatedAt(in.readString());
        setUpdatedAt(in.readString());
        headFileUrl = in.readString();
        coverFileUrl=in.readString();
        birthDay=in.readString();
        sex = in.readInt();
        userType=in.readInt();

    }


    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(getNickName());
        dest.writeString(getUsername());
        dest.writeString(getMobilePhoneNumber());
        dest.writeString(getObjectId());
        dest.writeString(getSessionToken());
        dest.writeString(getCreatedAt());
        dest.writeString(getUpdatedAt());
        dest.writeString(headFileUrl);
        dest.writeString(coverFileUrl);
        dest.writeString(birthDay);
        dest.writeInt(sex);
        dest.writeInt(userType);

    }



    public static final Parcelable.Creator<UserInfo> CREATOR = new Parcelable.Creator<UserInfo>() {
        public UserInfo createFromParcel(Parcel in) {
            return new UserInfo(in);
        }

        public UserInfo[] newArray(int size) {
            return new UserInfo[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getHeadFileUrl() {
        return headFileUrl;
    }

    public void setHeadFileUrl(String headFileUrl) {
        this.headFileUrl = headFileUrl;
    }

    public String getBirthDay() {
        return birthDay;
    }

    public void setBirthDay(String birthDay) {
        this.birthDay = birthDay;
    }

    public String getCoverFileUrl() {
        return coverFileUrl;
    }

    public void setCoverFileUrl(String coverFileUrl) {
        this.coverFileUrl = coverFileUrl;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }

    public Integer getUserType() {
        return userType;
    }

    public void setUserType(Integer userType) {
        this.userType = userType;
    }

    public BmobGeoPoint getGpsLocate() {
        return gpsLocate;
    }

    public void setGpsLocate(BmobGeoPoint gpsLocate) {
        this.gpsLocate = gpsLocate;
    }

    public static Creator<UserInfo> getCREATOR() {
        return CREATOR;
    }
}
